package info.cs52.fes.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Meal {

	@Id
	private long id;
	
	@ManyToMany
	@JoinTable(name="MealRecipe", 
			joinColumns={@JoinColumn(name="recipe")}, 
			inverseJoinColumns = {@JoinColumn(name="meal")} )
	private List<Recipe> recipes = new ArrayList<Recipe>();
	
	@Column
	private Date takenDate;
	
	@Column
	private MealTime mealTime;
	
	public Meal() {
	}
	
	public List<Recipe> getRecipes() {
		return recipes;
	}
	
	public void addRecipe(Recipe d) {
		recipes.add(d);
	}

	public void setTakenDate(Date takenDate) {
		this.takenDate = takenDate;
	}

	public Date getTakenDate() {
		return takenDate;
	}

	public void setMealTime(MealTime mealTime) {
		this.mealTime = mealTime;
	}

	public MealTime getMealTime() {
		return mealTime;
	}

	public long getId() {
		return id;
	}
	
}
